home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / basic / ace24dist.lha / ace24.lha / prgs / Astronomy / Messier.b < prev   
Text File  |  1996-09-11  |  11KB  |  346 lines

  1. '..Messier Object Finder.
  2.  
  3. const true=-1&,false=0&
  4. const sentinel=-1
  5. const max_lines=15
  6.  
  7. shortint M
  8. single MAG,DEC,RA
  9. string OBJ$,CONSTEL$
  10.  
  11. '..main program
  12. window 1,"Messier Finder",(0,0)-(640,200),6
  13.  
  14. font "topaz",8
  15.  
  16. finished=false
  17.  
  18. while not finished
  19. main:
  20.   restore
  21.   color 1
  22.   cls
  23.   locate 2,10: print "Options..."
  24.   locate 4,10: print "1. Show data for a single Messier object"
  25.   locate 5,10: print "2. List all Messier objects in a constellation"  
  26.   locate 6,10: print "3. List all Messier objects of a certain type"  
  27.   locate 7,10: print "4. List all Messier objects"
  28.   locate 8,10: print "5. Quit"
  29.   locate 10,10:print "Select an option (1..5)"
  30.   repeat
  31.     opt$=inkey$
  32.     Sleep
  33.   until opt$>="1" and opt$<="5"
  34.   if opt$="5" then 
  35.     finished=true
  36.   else
  37.     on val(opt$) gosub one_obj,by_const,by_obj_type,all_objs
  38.   end if
  39. wend
  40.  
  41. window close 1
  42. STOP
  43.  
  44. '..return to main menu upon ctrl-c break detection 
  45. ON BREAK GOTO main
  46. BREAK ON
  47.  
  48. SUB display_titles
  49.    '..column headings
  50.    print "M#";tab(10);" MAG";tab(20);" DEC";tab(30);" RA";tab(45);
  51.    print "Object";tab(65);"Constellation"
  52.    print "--";tab(10);" ---";tab(20);" ---";tab(30);" --";tab(45);
  53.    print "------";tab(65);"-------------"
  54. END SUB
  55.  
  56. SUB dm_form$(n,first$)
  57.   '..convert n to hrs/degs & mins format
  58.   '..hrs/degs
  59.   dh$=str$(fix(n))        
  60.   if n<10 then dh$=" 0"+right$(dh$,1)
  61.   x$=dh$+first$
  62.   '..mins
  63.   mins=abs(n-fix(n))*60
  64.   min$=str$(fix(mins))
  65.   if mins<10 then min$=" 0"+right$(min$,1)
  66.   x$=x$+min$+"m"
  67.   '..return string        
  68.   dm_form$=x$
  69. END SUB
  70.  
  71. SUB show_data
  72. SHARED M,MAG,DEC,RA,OBJ$,CONSTEL$
  73.    '..object data
  74.    print "M";M;tab(10);MAG;
  75.    print tab(20);dm_form$(DEC,"d");tab(30);dm_form$(RA,"h");
  76.    print tab(45);OBJ$;tab(65);CONSTEL$
  77. END SUB
  78.  
  79. BREAK STOP
  80. SUB await_return(msg$)
  81.   print
  82.   print msg$
  83.   while inkey$<>chr$(13):Sleep:wend  
  84. END SUB
  85. BREAK ON
  86.  
  87. '*************************************
  88.  
  89. one_obj:
  90.  '..display data about 1 Messier object.
  91.  cls
  92.  
  93.  locate 2,10:input "Enter Messier number: ",mes_num
  94.  
  95.  REPEAT
  96.   READ M, DEC, RA, MAG, OBJ$, CONSTEL$ 
  97.  UNTIL M = mes_num or M = sentinel
  98.  
  99.  if M <> mes_num or M = sentinel then 
  100.    locate 4,10:print "M";mes_num;"not found."
  101.  else
  102.    cls
  103.    display_titles
  104.    show_data
  105.  end if
  106.  
  107.  await_return("Hit <return> for menu...")
  108. RETURN
  109.  
  110. '*************************************
  111.  
  112. by_const:
  113.   '..display data about objects in a given constellation.
  114.   cls
  115.   locate 2,10
  116.   input "Enter name of constellation: ",target$
  117.   target$=ucase$(target$)
  118.  
  119.   obj_count=0
  120.   found=false
  121.  
  122.   cls
  123.   display_titles
  124.  
  125.   repeat
  126.     READ M, DEC, RA, MAG, OBJ$, CONSTEL$   
  127.     CONSTEL$=ucase$(CONSTEL$)   
  128.     if (instr(CONSTEL$,target$)or instr(target$,CONSTEL$)) and M<>sentinel then 
  129.       ++obj_count
  130.       found=true
  131.       show_data
  132.     end if
  133.     if obj_count = max_lines then
  134.       await_return("Hit <return> to continue...")
  135.       cls
  136.       display_titles
  137.       obj_count=0
  138.     end if  
  139.   until M = sentinel  
  140.  
  141.   if not found then 
  142.     print "No Messier objects were found in ";target$;"."
  143.   end if
  144.  
  145.   await_return("Hit <return> for menu...")
  146. RETURN
  147.  
  148. '*************************************
  149.  
  150. by_obj_type:
  151.   '..display data about objects of a given type.
  152.   cls
  153.   locate 2,10: PRINT "Object types..."
  154.   locate 4,10: PRINT "1. Diffuse Nebula"
  155.   locate 5,10: PRINT "2. Planetary Nebula" 
  156.   locate 6,10: PRINT "3. Globular Cluster"
  157.   locate 7,10: PRINT "4. Open Cluster"
  158.   locate 8,10: PRINT "5. Spiral Galaxy"
  159.   locate 9,10: PRINT "6. Elliptical Galaxy"
  160.   locate 10,10:PRINT "7. Irregular Galaxy"
  161.   locate 11,10:PRINT "8. None"
  162.   locate 13,10:PRINT "Select option (1..8)"
  163.   BREAK STOP
  164.   repeat
  165.     opt$=inkey$
  166.     Sleep
  167.   until opt$>="1" and opt$<="8"
  168.   BREAK ON
  169.   opt=val(opt$)
  170.  
  171.   case
  172.     opt=1 : target$="Diffuse Nebula" 
  173.     opt=2 : target$="Planetary Nebula" 
  174.     opt=3 : target$="Globular Cluster" 
  175.     opt=4 : target$="Open Cluster" 
  176.     opt=5 : target$="Spiral Galaxy" 
  177.     opt=6 : target$="Elliptical Galaxy" 
  178.     opt=7 : target$="Irregular Galaxy" 
  179.     opt=8 : return
  180.   end case
  181.  
  182.   obj_count=0
  183.   found=false
  184.  
  185.   cls
  186.   display_titles
  187.  
  188.   repeat
  189.     READ M, DEC, RA, MAG, OBJ$, CONSTEL$      
  190.     if OBJ$ = target$ and M <> sentinel then 
  191.       ++obj_count
  192.       found=true
  193.       show_data
  194.     end if
  195.     if obj_count = max_lines then
  196.       await_return("Hit <return> to continue...")
  197.       cls
  198.       display_titles
  199.       obj_count=0
  200.     end if  
  201.   until M = sentinel  
  202.  
  203.   if not found then 
  204.     print "No Messier objects of type: ";target$;" were found."
  205.   end if
  206.  
  207.   await_return("Hit <return> for menu...")
  208. RETURN
  209.  
  210. '*************************************
  211.  
  212. all_objs:
  213.  '..display data about all Messier objects.
  214.  obj_count=0
  215.  
  216.  cls
  217.  display_titles
  218.  
  219.  REPEAT
  220.   READ M, DEC, RA, MAG, OBJ$, CONSTEL$ 
  221.   if M <> sentinel then 
  222.     show_data
  223.     ++obj_count
  224.     if obj_count = max_lines then
  225.       await_return("Hit <return> to continue...")
  226.       cls
  227.       display_titles
  228.       obj_count=0
  229.     end if  
  230.   end if
  231.  UNTIL M = sentinel
  232.  
  233.  await_return("Hit <return> for menu...")
  234. RETURN
  235.  
  236. '************ Messier Data ********************* 
  237.  DATA 1,21.59,05.31,9,"Diffuse Nebula","Taurus" 
  238.  DATA 2,-01.03,21.31,7,"Globular Cluster","Aquarius" 
  239.  DATA 3,28.38,13.40,7,"Globular Cluster","Canes Vena" 
  240.  DATA 4,-26.24,16.21,6,"Globular Cluster","Scorpio" 
  241.  DATA 5,02.16,15.16,6,"Globular Cluster","Serp Caput" 
  242.  DATA 6,-32.11,17.37,6,"Diffuse Nebula","Sagittar" 
  243.  DATA 7,-34.48,17.51,5,"Open Cluster","Scorpio" 
  244.  DATA 8,-24.23,18.01,0,"Diffuse Nebula","Sagittar" 
  245.  DATA 9,-18.28,17.62,8,"Globular Cluster","Ophiuchus" 
  246.  DATA 10,-04.02,16.55,7,"Globular Cluster","Ophiuchus" 
  247.  DATA 11,-06.20,18.48,6,"Open Cluster","Scutum" 
  248.  DATA 12,-01.52,16.45,7,"Globular Cluster","Ophiuchus" 
  249.  DATA 13,36.33,16.40,6,"Globular Cluster","Hercules" 
  250.  DATA 14,-03.13,17.35,9,"Globular Cluster","Ophiuchus" 
  251.  DATA 15,11.57,21.28,7,"Globular Cluster","Pegasus" 
  252.  DATA 16,-13.48,18.16,7,"Open Cluster","Serp Cauda" 
  253.  DATA 17,-16.12,18.18,7,"Diffuse Nebula","Sagittar" 
  254.  DATA 18,-17.09,18.17,7,"Open Cluster","Sagittar" 
  255.  DATA 19,-26.11,16.59,8,"Globular Cluster","Ophiuchus" 
  256.  DATA 20,-23.02,17.59,0,"Diffuse Nebula","Sagittar" 
  257.  DATA 21,-22.30,18.02,7,"Open Cluster","Sagittar" 
  258.  DATA 22,-23.58,18.33,6,"Globular Cluster","Sagittar" 
  259.  DATA 23,-19.01,17.54,7,"Open Cluster","Sagittar" 
  260.  DATA 24,-18.30,18.14,5,"Open Cluster","Sagittar" 
  261.  DATA 25,-19.17,18.29,6,"Open Cluster","Sagittar" 
  262.  DATA 26,-09.27,18.43,8,"Open Cluster","Scutum" 
  263.  DATA 27,22.35,19.58,8, "Planetary Nebula","Vulpecula" 
  264.  DATA 28,-24.54,18.22,8,"Globular Cluster","Sagittar" 
  265.  DATA 29,38.22,20.22,7,"Open Cluster","Cygnus" 
  266.  DATA 30,-23.25,21.38,8,"Globular Cluster","Capricorn" 
  267.  DATA 31,41.00,00.40,4,"Spiral Galaxy","Andromeda" 
  268.  DATA 32,40.36,00.40,9,"Elliptical Galaxy","Andromeda" 
  269.  DATA 33,30.24,01.31,6,"Spiral Galaxy","Triangulm" 
  270.  DATA 34,42.34,02.39,6,"Open Cluster","Perseus" 
  271.  DATA 35,24.21,06.06,6,"Open Cluster","Gemini" 
  272.  DATA 36,34.06,05.33,6,"Open Cluster","Auriga" 
  273.  DATA 37,32.32,05.49,6,"Open Cluster","Auriga" 
  274.  DATA 38,35.48,05.25,7,"Open Cluster","Auriga" 
  275.  DATA 39,48.13,21.30,5,"Open Cluster","Cygnus" 
  276.  DATA 40,58.05,12.22,9,"Double Star ","Ursa Major" 
  277.  DATA 41,-20.41,06.45,6,"Open Cluster","Canis Ma" 
  278.  DATA 42,-05.25,05.33,0,"Diffuse Nebula","Orion" 
  279.  DATA 43,-05.18,05.33,0,"Diffuse Nebula","Orion" 
  280.  DATA 44,20.10,08.37,4,"Open Cluster","Cancer" 
  281.  DATA 45,23.57,03.44,2,"Open Cluster","Taurus" 
  282.  DATA 46,-14.42,07.40,7,"Open Cluster","Puppis" 
  283.  DATA 47,-14.22,07.34,5,"Open Cluster","Puppis" 
  284.  DATA 48,-05.38,08.11,6,"Open Cluster","Hydra" 
  285.  DATA 49,08.16,12.27,9,"Elliptical Galaxy","Virgo" 
  286.  DATA 50,-08.16,7.01,6,"Open Cluster","Monoceros" 
  287.  DATA 51,47.27,13.28,9,"Spiral Galaxy","Canes Vena" 
  288.  DATA 52,61.19,23.22,8,"Open Cluster","Cassiopeia" 
  289.  DATA 53,18.26,13.11,8,"Globular Cluster","Coma Beren" 
  290.  DATA 54,-30.32,18.52,8,"Globular Cluster","Sagittar" 
  291.  DATA 55,-31.03,19.37,6,"Globular Cluster","Sagittar" 
  292.  DATA 56,30.05,19.15,9,"Globular Cluster","Lyra" 
  293.  DATA 57,32.58,18.52,9,"Planetary Nebula","Lyra" 
  294.  DATA 58,12.05,12.35,10,"Spiral Galaxy","Virgo" 
  295.  DATA 59,11.55,12.40,10,"Elliptical Galaxy","Virgo" 
  296.  DATA 60,11.49,12.41,10,"Elliptical Galaxy","Virgo" 
  297.  DATA 61,04.45,12.19,10,"Spiral Galaxy","Virgo" 
  298.  DATA 62,-30.03,16.58,7,"Globular Cluster","Ophiuchus" 
  299.  DATA 63,42.17,13.14,9,"Spiral Galaxy","Canes Vena" 
  300.  DATA 64,21.57,12.54,8,"Spiral Galaxy","Coma Beren" 
  301.  DATA 65,13.23,11.16,10,"Spiral Galaxy","Leo" 
  302.  DATA 66,13.17,11.18,9,"Spiral Galaxy","Leo" 
  303.  DATA 67,12.00,08.49,7,"Open Cluster","Cancer" 
  304.  DATA 68,-26.29,12.37,9,"Globular Cluster","Hydra" 
  305.  DATA 69,-32.23,18.28,8,"Globular Cluster","Sagittar" 
  306.  DATA 70,-32.12,18.40,8,"Globular Cluster","Sagittar" 
  307.  DATA 71,18.39,19.52,8,"Globular Cluster","Sagitta" 
  308.  DATA 72,-12.44,20.51,9,"Globular Cluster","Aquarius" 
  309.  DATA 73,-12.50,20.56,0,"(Four Stars)","Aquarius" 
  310.  DATA 74,15.32,01.34,10,"Spiral Galaxy","Pisces" 
  311.  DATA 75,-22.04,20.03,9,"Globular Cluster","Sagittar" 
  312.  DATA 76,51.19,01.39,11,"Planetary Nebula","Perseus" 
  313.  DATA 77,-00.14,02.40,10,"Spiral Galaxy","Cetus" 
  314.  DATA 78,00.02,05.44,8,"Diffuse Nebula","Orion" 
  315.  DATA 79,-24.34,05.22,8,"Globular Cluster","Lepus" 
  316.  DATA 80,-22.52,16.14,8,"Globular Cluster","Scorpio" 
  317.  DATA 81,69.18,09.52,7,"Spiral Galaxy","Ursa Major" 
  318.  DATA 82,69.56,09.52,9,"Irregular Galaxy","Ursa Major" 
  319.  DATA 83,-29.37,13.34,8,"Spiral Galaxy","Hydra" 
  320.  DATA 84,13.10,12.23,10,"Elliptical Galaxy","Virgo" 
  321.  DATA 85,18.28,12.23,10,"Elliptical Galaxy","Coma Beren" 
  322.  DATA 86,13.13,12.24,10,"Elliptical Galaxy","Virgo" 
  323.  DATA 87,12.40,12.28,10,"Elliptical Galaxy","Virgo" 
  324.  DATA 88,14.42,12.30,10,"Spiral Galaxy","Coma Beren" 
  325.  DATA 89,12.50,12.33,11,"Elliptical Galaxy","Virgo" 
  326.  DATA 90,13.26,12.34,10,"Spiral Galaxy","Virgo" 
  327.  DATA 91,14.30,12.35,9,"Unexplained ","Coma Beren" 
  328.  DATA 92,43.12,17.16,7,"Globular Cluster","Hercules" 
  329.  DATA 93,-23.45,07.43,6,"Open Cluster","Puppis" 
  330.  DATA 94,41.23,12.49,9,"Spiral Galaxy","Canes Vena" 
  331.  DATA 95,11.58,10.41,10,"Spiral Galaxy","Leo" 
  332.  DATA 96,12.05,10.44,10,"Spiral Galaxy","Leo" 
  333.  DATA 97,55.18,11.12,11,"Planetary Nebula","Ursa Major" 
  334.  DATA 98,15.11,12.11,10,"Spiral Galaxy","Coma Beren" 
  335.  DATA 99,14.42,12.16,10,"Spiral Galaxy","Coma Beren" 
  336.  DATA 100,16.06,12.20,10,"Spiral Galaxy","Coma Beren" 
  337.  DATA 101,54.35,14.01,8,"Spiral Galaxy","Ursa Major" 
  338.  DATA 103,60.26,01.30,7,"Open Cluster","Cassiopeia" 
  339.  DATA 104,-11.21,12.37,8,"Spiral Galaxy","Virgo" 
  340.  DATA 105,12.51,10.45,10,"Elliptical Galaxy","Leo" 
  341.  DATA 106,47.35,12.17,9,"Spiral Galaxy","Canes Vena" 
  342.  DATA 107,-12.57,16.30,9,"Globular Cluster","Ophiuchus" 
  343.  DATA 108,55.57,11.09,10,"Spiral Galaxy","Ursa Major" 
  344.  DATA 109,53.39,11.55,10,"Spiral Galaxy","Ursa Major" 
  345.  DATA -1,0,0,0,"",""    '..sentinel
  346.